package com.jiaoyou.baojian;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;

import com.jiaoyou.baojian.activity.BaseActivity;
import com.jiaoyou.baojian.adapter.MainActivityPagerAdapter;
import com.jiaoyou.baojian.wiget.UnScrollableViewPager;
import com.lhh.apst.library.AdvancedPagerSlidingTabStrip;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MainActivityBak extends BaseActivity {

    @BindView(R.id.tabs)
    AdvancedPagerSlidingTabStrip tabs;
    @BindView(R.id.viewpager)
    UnScrollableViewPager viewpager;
    @BindView(R.id.my_toolbar)
    Toolbar my_toolbar;
    private MainActivityPagerAdapter mainPagerAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);

        setSupportActionBar(my_toolbar);
        setTitle(getString(R.string.app_name));

        viewpager.setPagingEnabled(false);
        mainPagerAdapter = new MainActivityPagerAdapter(getSupportFragmentManager());
        viewpager.setAdapter(mainPagerAdapter);
        tabs.setViewPager(viewpager);
    }

    @Override
    public int getContentView() {
        return R.layout.activity_main;
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
